import 'package:dirver/pages/home/tab_index/recommed_item.dart';
import 'package:flutter/material.dart';

class Recommend {
  String title;
  String subtitle;
  String imgUrl;
  String navigateUrl;

  Recommend(this.title,this.subtitle,this.imgUrl,this.navigateUrl);
}

List<Recommend> recommendList = [
  Recommend('推荐1','推荐1','assets/images/card.png','login'),
  Recommend('推荐2','推荐2','assets/images/clock.png','login'),
  Recommend('推荐3','推荐3','assets/images/position.png','login'),
  Recommend('推荐4','推荐4','assets/images/promotion.png','login'),
];


class RecommendWidget extends StatelessWidget {
  const RecommendWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 10),
      margin: EdgeInsets.only(top: 10),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text('推荐',style: TextStyle(fontSize: 16,color: Colors.black),),
              Text('更多',style: TextStyle(fontSize: 14,color: Colors.black45),),
            ],
          ),
          Padding(padding: EdgeInsets.all(5),),
          Wrap(
            spacing: 10,
            runSpacing: 10,
            children: recommendList.map((item) => Container(
              width: (MediaQuery.of(context).size.width - 30) /2,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(4),
              ),
              child: RecommendItem(data: item),
            )).toList(),
          )
        ],
      ),
    );
  }
}